Ad Widget

Collapse

MySQL - DB Upgrade 4.2.8 -> 4.4.1 - Can't DROP FOREIGN KEY `c_host_inventory_1`

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sc0th
    Junior Member
    • Nov 2019
    • 1

    #1

    MySQL - DB Upgrade 4.2.8 -> 4.4.1 - Can't DROP FOREIGN KEY `c_host_inventory_1`

    Hi folks,

    Would appreciate some help with this I am a little stuck, and my mysql fu is not what it could be.

    Upgrading from zabbix 4.2.8 -> 4.4.1 (using docker in k8s - not that I suspect that is important)

    Upgrade fails with the following:


    6:20191101:020745.790 [Z3005] query failed: [1091] Can't DROP FOREIGN KEY `c_host_inventory_1`; check that it exists [alter table host_inventory drop foreign key c_host_inventory_1]
    6:20191101:020745.790 database upgrade failed


    I have tried my best to add the key to appease the process yet I am poking around in the dark, making no progress.

    Any guidance gratefully received!

    Thanks!

    Scoth

    --

    6:20191101:020741.734 Starting Zabbix Server. Zabbix 4.4.1 (revision 8870606).
    6:20191101:020741.734 ****** Enabled features ******
    6:20191101:020741.734 SNMP monitoring: YES
    6:20191101:020741.734 IPMI monitoring: YES
    6:20191101:020741.734 Web monitoring: YES
    6:20191101:020741.734 VMware monitoring: YES
    6:20191101:020741.734 SMTP authentication: YES
    6:20191101:020741.734 ODBC: YES
    6:20191101:020741.734 SSH2 support: YES
    6:20191101:020741.734 IPv6 support: YES
    6:20191101:020741.734 TLS support: YES
    6:20191101:020741.734 ******************************
    6:20191101:020741.734 using configuration file: /etc/zabbix/zabbix_server.conf
    6:20191101:020741.752 current database version (mandatory/optional): 04020000/04020001
    6:20191101:020741.752 required mandatory version: 04040000
    6:20191101:020741.752 starting automatic database upgrade
  • zawex6
    Junior Member
    • Jan 2018
    • 9

    #2
    Please, help.
    I have exactly the same error.
    My server has been idle for a day
    Help!

    --
    23273:20200123:162114.359 Starting Zabbix Server. Zabbix 4.4.4 (revision 3131fdac04).
    23273:20200123:162114.359 ****** Enabled features ******
    23273:20200123:162114.360 SNMP monitoring: YES
    23273:20200123:162114.360 IPMI monitoring: YES
    23273:20200123:162114.360 Web monitoring: YES
    23273:20200123:162114.360 VMware monitoring: YES
    23273:20200123:162114.360 SMTP authentication: YES
    23273:20200123:162114.360 ODBC: YES
    23273:20200123:162114.360 SSH2 support: YES
    23273:20200123:162114.360 IPv6 support: YES
    23273:20200123:162114.360 TLS support: YES
    23273:20200123:162114.360 ******************************
    23273:20200123:162114.360 using configuration file: /etc/zabbix/zabbix_server.conf
    23273:20200123:162114.363 current database version (mandatory/optional): 04030035/04030035
    23273:20200123:162114.364 required mandatory version: 04040000
    23273:20200123:162114.364 starting automatic database upgrade
    23273:20200123:162114.364 [Z3005] query failed: [1091] Can't DROP FOREIGN KEY `c_host_inventory_1`; check that it exists [alter table host_inventory drop foreign key c_host_inventory_1]
    23273:20200123:162114.364 database upgrade failed

    Comment

    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #3
      Originally posted by Sc0th
      Upgrading from zabbix 4.2.8 -> 4.4.1 (using docker in k8s - not that I suspect that is important)

      Upgrade fails with the following:


      6:20191101:020745.790 [Z3005] query failed: [1091] Can't DROP FOREIGN KEY `c_host_inventory_1`; check that it exists [alter table host_inventory drop foreign key c_host_inventory_1]
      If you use 'mysql' command line tool to connect to your mysql database as your zabbix user and run the following:

      show create table `host_inventory`;

      (be sure you have the "show" at the start), does the resulting output include:

      Code:
      CONSTRAINT `c_host_inventory_1` FOREIGN KEY (`hostid`) REFERENCES `hosts` (`hostid`) ON DELETE CASCADE
      It's there for me (we're on 4.2.5 currently), near the very bottom of the output.

      Is it there in your output?

      Comment

      Working...